home *** CD-ROM | disk | FTP | other *** search
- /*****
- *
- * ErrorInt.c
- *
- * This is a support file for "Grant's CGI Framework".
- * Please see the license agreement that accompanies the distribution package
- * for licensing details.
- *
- * Copyright ©1995,1996 by Grant Neufeld
- * grant@acm.com
- * http://arpp.carleton.ca/grant/
- *
- *****/
-
- #include "MyConfiguration.h"
- #if kCompileWithForeground
-
- #include "compiler_stuff.h"
-
- #include "DebugUtil.h"
- #include "DialogFunc.h"
- #include "MemoryUtil.h"
-
- #include "ErrorInt.h"
-
-
- /*** FUNCTIONS ***/
-
- /** Report System Errors **/
-
- /* Display a system error alert with the given string. */
- void
- ErrorAlertSystemString (
- OSErr errNum,
- StringHandle errStrHdl,
- Str255 * errNameStrPtr
- )
- {
- Str255 errNumStr; /* used for string version of the error number */
- short alertItem;
-
- my_assert ( (errStrHdl != NULL) && (*errStrHdl != NULL),
- "\pErrorIntSystemString: null error string" );
-
- /* Create a pascal format string of the error number. */
- NumToString ( errNum, errNumStr );
-
- my_assert ( (HGetState((Handle)errStrHdl) & kMemoryHandleLockedFlag) == nil,
- "\pErrorAlertSystemString: errStrHdl is already locked!" );
- HLockHi ( (Handle)errStrHdl );
-
- if ( errNameStrPtr == NULL )
- {
- /* Set the dialog to display the string and error number strings. */
- ParamText ( *((Str255 *)errStrHdl), errNumStr, NULL, NULL );
- }
- else
- {
- /* Set the dialog to display the string and error number strings. */
- ParamText ( *((Str255 *)errStrHdl), errNumStr, *errNameStrPtr, NULL );
- }
-
- /* Display the alert. */
- alertItem = StopAlert ( krErrorDialogSystem, NewModalFilterProc(defaultAlert1ButtonEventFilter) );
-
- HUnlock ( (Handle)errStrHdl );
- } /* ErrorAlertSystemString */
-
-
- /** Report Startup Errors **/
-
- #pragma segment Startup
- /* Display a startup error alert with the given string. */
- void
- ErrorAlertStartupString ( short errNum, Str255 *errStrHdl )
- {
- Str255 errNumStr; /* used for string version of the error number */
- short alertItem;
-
- /* Create a pascal format string of the error number. */
- NumToString ( errNum, errNumStr );
-
- /* Set the dialog to display the string and error number strings. */
- ParamText ( *errStrHdl, errNumStr, NULL, NULL );
-
- /* Display the alert. */
- alertItem = StopAlert ( krErrorDialogStartup, NewModalFilterProc(defaultAlert1ButtonEventFilter) );
- } /* ErrorAlertStartupString */
- #pragma segment Main
-
-
- #endif /* kCompileWithForeground */
-
- /***** EOF *****/
-